#ifndef BUFFER_H
#define BUFFER_H

#include <QMutex>
#include <QObject>
#include <QSemaphore>
#include <QString>
#include <QLabel>
#include <QTextEdit>

class Buffer : public QObject
{
    Q_OBJECT

public:
                int bufferSize,posicaoEscreve,posicaoLe,totalProdutos,countLabelacao,totalProdutosPraLeitura;
		QSemaphore * semaforoUsados;
		QSemaphore * semaforoLivres;
                QMutex	* mutex;
                int * vetor;

                int countLabelSemaforos;
                QLabel * labelSaida;
								QLabel * labelSemaforos;

explicit Buffer(QObject *parent = 0);
                Buffer(int,int);
                int le();
                int escreve(int);
								void showStatus();
								void setLabelSemaphoros(QLabel *);
								void setSaidaDoLabelSemaforos(QString);
signals:
                void mudouBuffer(int * buffer,int posicaoEscrita,QMutex *);
                void leuBuffer(int * buffer,int posicaoLeitura,QMutex *);
public slots:

};

#endif // BUFFER_H
